#include "gtest/gtest.h"

#include "stream/impl/rocksdb/Data.h"



TEST(DataTest, test){
	auto data = std::shared_ptr<::stream::impl::rocksdb::Data>( ::stream::impl::rocksdb::makeData("test-data.db"));
	data->open();

	const std::string key = "hello";
	ASSERT_TRUE(data->append(key, "world") > 0);

	std::string value;
	ASSERT_TRUE(data->get(key,value));

	size_t sz = 0;
	ASSERT_TRUE(data->size(sz));
	ASSERT_EQ(1ull, sz);

	ASSERT_TRUE(data->append("hello1", "world1") > 0);

	ASSERT_TRUE(data->size(sz));
	ASSERT_EQ(2ull, sz);

	data->clear();
	data->clear();

	data->close();
}
